﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using DTO;
using DataService;

public partial class Admin_AddPlan : BasePage
{
    private DeviceService deviceService = new DeviceService();
    private IList<Device.Memory> Memorys;
    private IList<Device.CPUs> CPUs;
    private IList<Device.DiskSpace> DiskPlaces;
    private IList<Device.Specification> Specifications;

    private AdminService adminService = new AdminService();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (AdminLogin != null)
        {            
            Memorys = deviceService.GetListMemory();
            CPUs = deviceService.GetListCPU();
            DiskPlaces = deviceService.GetListDiskPlace();
            Specifications = deviceService.GetListSpecifications();
            if (!IsPostBack)
            {
                Inittial();
            }
        }

        else
        {
            Response.Redirect("~/admin/login.aspx");
        }
    }

    private void Inittial()
    {
        if (Memorys != null)
        {
            ddlMemory.DataSource = Memorys;
        }
        if (CPUs != null)
        {
            ddlCpu.DataSource = CPUs;
        }
        if (DiskPlaces != null)
        {
            ddlDiskPlace.DataSource = DiskPlaces;
        }
        if (Specifications != null)
        {
            ddlSpecification.DataSource = Specifications;
        }
        DataBind();
    }

    protected void btUpdate_Click(object sender, EventArgs e)
    {

    }
    protected void btCancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("default.aspx");
    }
}